package main

import (
	"fmt"
	"time"
)

func send(ch chan int, begin int) {
	for i := begin; i < begin+10; i++ {
		ch <- i
	}
}
func main() {
	ch1 := make(chan int)
	ch2 := make(chan int)

	go send(ch1, 0)
	go send(ch2, 0)
	time.Sleep(time.Second)
	for {
		select {
		case Val := <-ch1:
			fmt.Printf("get value %d from ch1 \n", Val)
		case val := <-ch2:
			fmt.Printf("get value %d from ch \n", val)
		case <-time.After(time.Second * 2):
			fmt.Printf("Time out")
			return
		}
	}
}
